<template>
  <div class="home">
    <div class="body">
      <div class="title" v-if="info.TaskType == 1">请将本垛({{barCode}})货物运送至</div>
      <div class="title" v-if="info.TaskType == 0">请将本垛({{barCode}})货物从此运出</div>
      <div class="content">
        <ul>
          <li class="number">{{info.ShelfName || '--'}}</li>
          <li class="row">{{info.ColumnID || '--'}}列</li>
          <li class="layer">{{info.FloorID || '--'}}层</li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import {getShelfKWListByBarCode} from '@/api/sreen'
export default {
  name: 'demo',
  data () {
    return {
      info: {
        TaskType: 1,
        ShelfName: '',
        ColumnID: '',
        FloorID: ''
      },
      barCode: 66666
    }
  },
  computed: {},
  components: {},
  methods: {
    // 正在上架或者下架的信息
    getInfo () {
      let vm = this
      let params = new FormData()
      params.append('BarCode', vm.barCode)
      getShelfKWListByBarCode(params).then((response) => {
        if (response.data.data && response.data.data.length && response.data.data.length > 0) {
          vm.info = response.data.data[0]
        }
      })
    }
  },
  watch: {},
  mounted () {
    let vm = this
    vm.getInfo()
    vm.setInterval = setInterval(() => {
      vm.getInfo()
    }, 1000)
  },
  beforeDestroy: function () {
    let vm = this
    clearInterval(vm.setInterval)
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss">
@import "~@/css/sreen/guide.scss";
</style>
